package cc.magicjson.example.demo.threadlocal.context;

import cc.magicjson.example.demo.domain.UserInfo;
import com.alibaba.ttl.TransmittableThreadLocal;

/**
 * {@link}
 *
 * @author <a href="mailto:it_magicjson@163.com">MagicJson</a>
 * @since 1.0.0
 */
public class UserContext {
	private static final ThreadLocal<UserInfo> threadLocal = new TransmittableThreadLocal<>();

	public static UserInfo getUserInfo(){
		return threadLocal.get();
	}


	public static void setUserInfo(UserInfo userInfo){
		threadLocal.set(userInfo);
	}


	public static void clearUserInfo(){
		threadLocal.remove();
	}



}
